<extend name="extends/extend" />
<block name="script">
    <!-- sweetalert js -->
    <script src="__admin__/js/plugins/sweetalert/sweetalert.min.js"></script>
    <script>
        $(document).ready(function () {
            var url = '{$url}';
            var message = '{:strip_tags($msg)}';
            var time = '{$wait}';
            var jump = function () {
                (url === null || url.length === 0 || url === 'javascript:history.back(-1);')?history.go(-1):$(location).attr('href', url);
            };
            swal({
                title: message,
                text: '页面自动跳转,等待时间: '+(time)+' 秒!',
                icon: "success",
                dangerMode: true,
            }).then(function (boolean){
                jump();
            });
            (function(){
                var interval = setInterval(function(){
                    time -= 1;
                    var message = '页面自动跳转,等待时间: '+(time)+' 秒!';
                    $('.swal-text').html(message);
                    if(time <= 0) {
                        jump();
                        clearInterval(interval);
                    };
                }, 1000);
            })();
        });
    </script>
</block>